home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBASE102.ARJ / BPUTB.C < prev    next >
Text File  |  1991-09-23  |  2KB  |  62 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)bputb.c    1.5 - 91/09/23" */
  5.  
  6. #include <ansi.h>
  7.  
  8. /* ansi headers */
  9. #ifdef AC_STDDEF
  10. #include <stddef.h>
  11. #endif
  12.  
  13. /* local headers */
  14. #include "blkio_.h"
  15.  
  16. /*man---------------------------------------------------------------------------
  17. NAME
  18.      bputb - put a block into a block file
  19.  
  20. SYNOPSIS
  21.      #include <blkio.h>
  22.  
  23.      int bputb(bp, bn, buf)
  24.      BLKFILE *bp;
  25.      bpos_t bn;
  26.      const void *buf;
  27.  
  28. DESCRIPTION
  29.      The bputb function writes the block pointed to by buf into block
  30.      number bn of the block file associated with BLKFILE pointer bp.
  31.      buf must point to a storage area at least as large as the block
  32.      size for bp.
  33.  
  34.      bputb will fail if one or more of the following is true:
  35.  
  36.      [EINVAL]       bp is not a valid BLKFILE pointer.
  37.      [EINVAL]       bn is less than 1.
  38.      [EINVAL]       buf is the NULL pointer.
  39.      [BEEOF]        There are fewer than bn - 1 blocks in
  40.                     the file.
  41.      [BENOPEN]      bp is not open for writing.
  42.  
  43. SEE ALSO
  44.      bgetb, bputbf, bputh.
  45.  
  46. DIAGNOSTICS
  47.      Upon successful completion, a value of 0 is returned.  Otherwise,
  48.      a value of -1 is returned, and errno set to indicate the error.
  49.  
  50. ------------------------------------------------------------------------------*/
  51. #ifdef AC_PROTO
  52. int bputb(BLKFILE *bp, bpos_t bn, const void *buf)
  53. #else
  54. int bputb(bp, bn, buf)
  55. BLKFILE *bp;
  56. bpos_t bn;
  57. const void *buf;
  58. #endif
  59. {
  60.     return bputbf(bp, bn, (size_t)0, buf, bp->blksize);
  61. }
  62.